package ping.pay.me.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.SimpleAdapter;
import ping.pay.me.R;
import ping.pay.me.common.Style;

import java.util.ArrayList;
import java.util.HashMap;


/**
 * Created by install on 14/12/14.
 */
public class StyleListActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.style_list_activity);

        final GridView styleList = (GridView)findViewById(R.id.style_list_gv);

        Style style = new Style("简 约",R.drawable.icon);

        HashMap<String,Object>map = new HashMap<String, Object>();
        map.put("title",style.getStyleName());
        map.put("img",style.getPicId());
        ArrayList<HashMap<String,Object>> items = new ArrayList<HashMap<String, Object>>();
        items.add(map);
        items.add(map);
        items.add(map);
        items.add(map);
        items.add(map);
        items.add(map);
        items.add(map);

        SimpleAdapter ap = new SimpleAdapter(this,items,R.layout.style_item,new String[]{"title","img"},new int[]{R.id.title,R.id.img});
        styleList.setAdapter(ap);

        styleList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                Log.d("tag","click");
                startActivity(new Intent(StyleListActivity.this,GoodsListActivity.class));
            }
        });
    }
}